package com.apestech.framework.xml;

import com.apestech.formwork.xml.XmlQuery;
import com.apestech.framework.db.SqlSession;
import com.apestech.framework.json.JSONObject;
import com.apestech.framework.xml.plugin.XmlPaste;
import com.apestech.framework.xml.plugin.modul.QryConfig;
import org.dom4j.Element;

/**
 * @author hup
 * @create 2018-12-19-16:15
 */
public class XmlUtil {

    public static QryConfig getQueryConfig(String queryId) throws Exception {
        XmlQuery xmlQuery=new XmlQuery(queryId);
        Element n= xmlQuery.getNode(queryId);
        if(n==null) return null;
        n= (Element) n.selectSingleNode("qryConfig");
        if(n==null) return null;
        XmlPaste xml=new XmlPaste((SqlSession) null);
        xml.expain(xmlQuery.getRoot(), n);
        return xml.getQryConfig();
    }

    public static JSONObject getResult(String key){
        return null;
    }

}
